var Version = {
    update:function () {
        if (uexWidgetOne.platformName == "android") {
            $.ajax({
                url: server_path + "/upgrade/android.json",
                type: "GET",
                contentType: "application/json;charset=utf-8",
                success: function(res) {
                    var results = typeof res === 'object' ? res : JSON.parse(res);
                    if (results.version > constant.version) {
                    	LS.set("isUpdate", "true");
                    	var _changelog = results.changelog || '';
                        appcan.window.confirm({
                            title:'发现新版本，是否更新？',
                            content:"\n版本号：v" + results.version+ "\n修改日志:\n" + _changelog,
                            buttons:['取消','确定'],
                            callback:function(err,data,dataType,optId){
                                if(err){
                                    //如果出错了
                                    return;
                                }
                                if(data == 1){
                                    // uexStatusBarIcon.addIconToStatusbar('欧淘学','正在下载中...'); 
                                    Download.download(results.url, "down/know.apk", function(){
                                        // uexStatusBarIcon.deleteIconToStatusbar();
                                        uexWidget.installApp("wgt://data/down/know.apk");
                                    }, false);
                                }
                            }
                        });         
                    } else {
                    	LS.set("isUpdate", false);
                    }
                }, 
                error: function(XMLHttpRequest, textStatus) {
                }
            });
        }
    }
}